<!DOCTYPE html>
<html>
<head>
<title>Google 桌面通知</title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
</head>
<body>

<button id='btn'>显示桌面通知</button> 


</body>
<script src="https://cdn.bootcss.com/socket.io/2.0.4/socket.io.js" >
</script>
<script  src="DataSocket.js" >
</script>
<script >
	function hello(){
		alert("xinbaby");
	}

	function requestNotificationPermission(){
		console.log("chrome notification");
		if(Notification.permission != "granted"){
			Notification.requestPermission(function(permission){
				console.log(permission);
			});
		}else{
			console.log("chrome notfitication is granded");
		}
	}
	function testNofiction(){
	 if("Notification" in window){
	  console.log("chrome support notification");
	   var notification = new Notification("Notification title",{
		  icon:"https://tva4.sinaimg.cn/crop.0.0.180.180.180/716a98b5jw1e8qgp5bmzyj2050050aa8.jpg",
		  body:"begin notification"
		  });
		  notification.onclick = function(){
		  window.open("http://www.baidu.com");
		  }
		}
	}
	//testNofiction();
	
	requestNotificationPermission();
	</script>
</html>



